﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService

Partial Class FrontEnd_Control_Footer
    Inherits System.Web.UI.UserControl

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then

            Dim lstNodeSEO As New DataSet
            lstNodeSEO.ReadXml(MapPath("../../xml/FooterSEO.xml"))
            With rptSEO
                .DataSource = lstNodeSEO.Tables("Node")
                .DataBind()
            End With
            BindNhanHieu()
        End If
    End Sub
    Protected Sub BindNhanHieu()
        Using Data As New VSEntities
            Dim p = (From q In Data.ProductUnits Select q).ToList
            With (rptNhanHieu)
                .DataSource = p
                .DataBind()
            End With
        End Using
    End Sub

    Protected Sub rptSEO_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptSEO.ItemDataBound
        Dim hplTitle As HyperLink
        hplTitle = e.Item.FindControl("hplTitle")

        ' hplTitle.NavigateUrl = DomainURL & "Page/Default.aspx?DepID=" & e.Item.DataItem("DepID").ToString
        hplTitle.NavigateUrl = e.Item.DataItem("URL").ToString
        hplTitle.Text = "<h3>" & e.Item.DataItem("Title") & "</h3>"

    End Sub
    Protected Sub rptNhanHieu_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptNhanHieu.ItemDataBound
        Dim row As VSModel.ProductUnit = CType(e.Item.DataItem, VSModel.ProductUnit)
        'Dim hplTitle As HyperLink = e.Item.FindControl("hplTitle")
        Dim hplNhanHieu As HyperLink = e.Item.FindControl("hplNhanHieu")
        hplNhanHieu.Text = row.ProductUnitName
        hplNhanHieu.NavigateUrl = MainDomain & "tim-kiem-san-pham" & ".html?BrandId=" & row.ProductUnitID
    End Sub
End Class
